package jCross.gui;

import java.awt.BorderLayout;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

import javax.swing.JFrame;

public class MainFrame extends JFrame {
	private MainPanel mainPanel = null;
	private UpPanel upPanel = null;
	private LeftPanel leftPanel = null;
	
	public MainFrame() {
		super("JCross");
		
		mainPanel = new MainPanel();
		upPanel = new UpPanel();
		leftPanel = new LeftPanel();
		
		getContentPane().setLayout(new BorderLayout());
		
		getContentPane().add(mainPanel, BorderLayout.CENTER);
		getContentPane().add(upPanel, BorderLayout.NORTH);
		getContentPane().add(leftPanel, BorderLayout.WEST);
		
		addKeyListener(new KeyAdapter() {
			@Override
			public void keyPressed(KeyEvent e) {
				if(e.isControlDown()) {
					if(e.getKeyCode() == KeyEvent.VK_A) {
						mainPanel.drawGrid = !mainPanel.drawGrid;
						mainPanel.repaint();
					}
					if(e.getKeyCode() == KeyEvent.VK_S) {
						mainPanel.drawDoubleGrid = !mainPanel.drawDoubleGrid;
						mainPanel.repaint();
					}
				}
			}
		});
		
		setSize(500, 400);
		setLocation(300, 200);
		setVisible(true);
		setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	}
}
